package ch8;

import java.util.Scanner;

public class Zuoye12 {//12：定义一个整数数组，输出比平均值大的数

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入数组长度：");
        int c = input.nextInt();
        int[] a = new int[c];
        int b = 0;
        for (int i = 0; i < a.length; i++) {
            System.out.println("请输入数组的第" + (i + 1) + "个数：");
            a[i] = input.nextInt();
        }
        for (int j = 0; j < a.length; j++) {
            b += a[j];
        }
        int avg = b / a.length;
        for (int k = 0; k < a.length; k++) {
            if (a[k] > avg) {
                System.out.print(a[k] + "  ");
            }
        }
    }
}
